package com.ac.scum.log.web.model.menu.mapper;

import com.ac.scum.log.bean.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface MenuMapper extends BaseMapper<Menu> {

    default List<Menu> getMenuByServerId(long serverId) {
        return selectList(Wrappers.lambdaQuery(Menu.class)
                .inSql(Menu::getId, "select menu_id from package_menu where package_id in (select package_id from server_package where server_id = " + serverId + ")")
                .orderByAsc(Menu::getSortId));
    }
}
